package com.ysx.oa.resume.controller;

import com.ysx.oa.resume.Bean.CompanyBean;
import com.ysx.oa.resume.Bean.JobBean;
import com.ysx.oa.resume.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 黄德标
 * @date 2021/11/25 16:12
 */
@RestController
@RequestMapping("/company")
public class CompanyController {

    @Autowired
    private CompanyService companyService;

    /**
     * 方法描述: 添加一个 公司信息 到公司表
     * @author: 黄德标
     * URL: http://localhost:8080/kaoqin/company/addCompany
     *
     * @date: 2021/11/25 16:32
     * @param: [com.ysx.oa.resume.Bean.CompanyBean]
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     */
    @RequestMapping(value = "/addCompany",method = RequestMethod.POST)
    public Map<String,Object> addCompany(@RequestBody CompanyBean companyBean){
        Map<String,Object> map = new HashMap<>();

        companyService.addCompany(companyBean);

        map.put("code",200);
        map.put("message","success");
        map.put("data","添加成功");
        return map;
    }

    /**
     * 方法描述: 查询 所有公司信息
     * @author: 黄德标
     * URL: http://localhost:8080/kaoqin/company/selectAllCompany
     * @date: 2021/11/25 16:39
     * @param: []
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     */
    @RequestMapping(value = "/selectAllCompany",method = RequestMethod.GET)
    public Map<String,Object> selectAllCompany(){
        Map<String,Object> map = new HashMap<>();

        ArrayList<CompanyBean> companyBeanArrayList
                = companyService.selectAllCompanyBean();

        map.put("code",200);
        map.put("message","success");
        map.put("data",companyBeanArrayList);
        return map;
    }



}